package com.lmy.springboot.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@TableName(value = "furn")
@Data
public class Furn {

    //当使用@TableId标识属性时，标识该属性对应的表字段是主键
    //type = IdType.AUTO 标识当前主键是自增长
    @TableId(type = IdType.AUTO)
    private Integer id;

    @NotEmpty(message = "请输入家居名称")
    private String name;

    @NotEmpty(message = "请输入厂商")
    private String maker;

    @NotNull(message = "请输入价格")
    @Range(min = 0, message = "价格不能小于0")
    private Double price;

    @NotNull(message = "请输入销量")
    @Range(min = 0, message = "销量不能小于0")
    private Integer sales;

    @NotNull(message = "请输入库存")
    @Range(min = 0, message = "库存不能小于0")
    private Integer stock;

}
